<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<div>
    <div>
        <%--            没登录只显示登录前的信息--%>
        <c:if test="${empty sessionScope.user}">
            <a href="page/user/login.jsp">登录</a>&nbsp;&nbsp;
            <a href="page/user/register.jsp">注册</a>

        </c:if>
        <%--            显示登录以后的信息--%>
        <c:if test="${not empty sessionScope.user}">
            <c:if test="${ not sessionScope.user.username.equals(\"root\")}">
                <a href="RecordServlet?action=GetRecord&uid=${sessionScope.user.id}&stat=">我的记录</a>&nbsp;&nbsp;
                <a href="page/cart/cart.jsp">购物车</a>&nbsp;&nbsp;
                <a href="UserServlet?action=logout">注销</a>
            </c:if>
            <c:if test="${ sessionScope.user.username.equals(\"root\")}">
                <a href="UserServlet?action=logout">注销</a>&nbsp;&nbsp;
                <a href="page/sale/sale.jsp">后台</a>
            </c:if>
        </c:if>

        <a href="index.jsp">返回首页</a>
    </div>

</div>
